home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Found / FWExcLib / Include / FWTryBlo.h < prev   
Encoding:
C/C++ Source or Header  |  1994-04-21  |  2.2 KB  |  80 lines  |  [TEXT/MPS ]

  1. #ifndef FWTRYBLO_H
  2. #define FWTRYBLO_H
  3. //========================================================================================
  4. //
  5. //    File:                FWTryBlo.h
  6. //    Release Version:    $ 1.0d1 $
  7. //
  8. //    Creation Date:        3/28/94
  9. //
  10. //    Copyright:    © 1994 by Apple Computer, Inc., all rights reserved.
  11. //
  12. //========================================================================================
  13.  
  14. #include <setjmp.h>
  15.  
  16. #ifdef FW_BUILD_WIN32S
  17. // [?KVV]    Symantec C++ hack: setjmp.h defines setjmp to Catch and longjmp to Throw
  18. //            which is not valid for Win32.  Fortunately, it seems that we can use
  19. //            standard library setjmp/longjmp.  We just need to declare them.
  20. #undef setjmp
  21. int __CLIB setjmp(jmp_buf);
  22. #undef longjmp
  23. void __CLIB longjmp(jmp_buf, int);
  24. #endif
  25.  
  26. #ifndef   FWEXCTAS_H
  27. #include "FWExcTas.h"
  28. #endif
  29.  
  30. //========================================================================================
  31. // CLASS _FW_CTryBlockContext
  32. //========================================================================================
  33.  
  34. class _FW_CTryBlockContext
  35. {
  36. public:
  37.     _FW_CTryBlockContext(FW_SPrivExceptionGlobals& globals, jmp_buf buffer);
  38.     ~_FW_CTryBlockContext();
  39.     
  40.     void *operator new(size_t, void *);
  41.     void operator delete(void *);
  42.  
  43.     FW_SPrivExceptionGlobals&     fGlobals;
  44.     class _FW_CTryBlockContext     *fPriorContext;
  45.     _FW_StackEntries             fDeleteStackLevel;
  46.     jmp_buf                        *fJumpBuffer;
  47.     short                        fIsActive;
  48.  
  49. #ifdef FW_DEBUG
  50.     short                        fAutomaticsInMyScope;
  51.     unsigned short                 fTraceDepth;
  52.     void                        CheckClassInvariants(FW_SPrivExceptionGlobals& globals);
  53. #endif
  54.  
  55. private:
  56.  
  57.     static _FW_CTryBlockContext    *MakeCurrent(FW_SPrivExceptionGlobals& globals,
  58.                                             _FW_CTryBlockContext *context);
  59.  
  60. };
  61.  
  62. //----------------------------------------------------------------------------------------
  63. // _FW_CTryBlockContext::operator new
  64. //----------------------------------------------------------------------------------------
  65.  
  66. inline void* _FW_CTryBlockContext::operator new(size_t, void *ptr)
  67. {
  68.     return ptr;
  69. }
  70.  
  71. //----------------------------------------------------------------------------------------
  72. // _FW_CTryBlockContext::operator delete
  73. //----------------------------------------------------------------------------------------
  74.  
  75. inline void _FW_CTryBlockContext::operator delete(void *)
  76. {
  77. }
  78.  
  79. #endif
  80.